home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / etc / sample.emacs.z / sample.emacs
Encoding:
Text File  |  1998-05-21  |  25.2 KB  |  656 lines

  1. ;; -*- Mode: Emacs-Lisp -*-
  2.  
  3. ;;; This is a sample .emacs file.
  4. ;;;
  5. ;;; The .emacs file, which should reside in your home directory, allows you to
  6. ;;; customize the behavior of Emacs.  In general, changes to your .emacs file
  7. ;;; will not take effect until the next time you start up Emacs.  You can load
  8. ;;; it explicitly with `M-x load-file RET ~/.emacs RET'.
  9. ;;;
  10. ;;; There is a great deal of documentation on customization in the Emacs
  11. ;;; manual.  You can read this manual with the online Info browser: type
  12. ;;; `C-h i' or select "Emacs Info" from the "Help" menu.
  13.  
  14.  
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;;            Basic Customization                ;;
  17. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  18.  
  19. ;; Enable the command `narrow-to-region' ("C-x n n"), a useful
  20. ;; command, but possibly confusing to a new user, so it's disabled by
  21. ;; default.
  22. (put 'narrow-to-region 'disabled nil)
  23.  
  24. ;;; Define a variable to indicate whether we're running XEmacs/Lucid Emacs.
  25. ;;; (You do not have to defvar a global variable before using it --
  26. ;;; you can just call `setq' directly like we do for `emacs-major-version'
  27. ;;; below.  It's clearer this way, though.)
  28.  
  29. (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
  30.  
  31. ;; Make the sequence "C-x w" execute the `what-line' command, 
  32. ;; which prints the current line number in the echo area.
  33. (global-set-key "\C-xw" 'what-line)
  34.  
  35. ;; set up the function keys to do common tasks to reduce Emacs pinky
  36. ;; and such.
  37.  
  38. ;; Make F1 invoke help
  39. (global-set-key [f1] 'help-command)
  40. ;; Make F2 be `undo'
  41. (global-set-key [f2] 'undo)
  42. ;; Make F3 be `find-file'
  43. ;; Note: it does not currently work to say
  44. ;;   (global-set-key 'f3 "\C-x\C-f")
  45. ;; The reason is that macros can't do interactive things properly.
  46. ;; This is an extremely longstanding bug in Emacs.  Eventually,
  47. ;; it will be fixed. (Hopefully ..)
  48. (global-set-key [f3] 'find-file)
  49.  
  50. ;; Make F4 be "mark", F5 be "copy", F6 be "paste"
  51. ;; Note that you can set a key sequence either to a command or to another
  52. ;; key sequence.
  53. (global-set-key [f4] 'set-mark-command)
  54. (global-set-key [f5] "\M-w")
  55. (global-set-key [f6] "\C-y")
  56.  
  57. ;; Shift-F4 is "pop mark off of stack"
  58. (global-set-key [(shift f4)] (lambda () (interactive) (set-mark-command t)))
  59.  
  60. ;; Make F7 be `save-buffer'
  61. (global-set-key [f7] 'save-buffer)
  62.  
  63. ;; Make F8 be "start macro", F9 be "end macro", F10 be "execute macro"
  64. (global-set-key [f8] 'start-kbd-macro)
  65. (global-set-key [f9] 'end-kbd-macro)
  66. (global-set-key [f10] 'call-last-kbd-macro)
  67.  
  68. ;; Here's an alternative binding if you don't use keyboard macros:
  69. ;; Make F8 be `save-buffer' followed by `delete-window'.
  70. ;;(global-set-key 'f8 "\C-x\C-s\C-x0")
  71.  
  72. ;; If you prefer delete to actually delete forward then you want to
  73. ;; uncomment the next line (or use `Customize' to customize this).
  74. ;; (setq delete-key-deletes-forward t)
  75.  
  76.  
  77. (cond (running-xemacs
  78.        ;;
  79.        ;; Code for any version of XEmacs/Lucid Emacs goes here
  80.        ;;
  81.  
  82.        ;; Change the values of some variables.
  83.        ;; (t means true; nil means false.)
  84.        ;;
  85.        ;; Use the "Describe Variable..." option on the "Help" menu
  86.        ;; to find out what these variables mean.
  87.        (setq find-file-use-truenames nil
  88.          find-file-compare-truenames t
  89.          minibuffer-confirm-incomplete t
  90.          complex-buffers-menu-p t
  91.          next-line-add-newlines nil
  92.          mail-yank-prefix "> "
  93.          kill-whole-line t
  94.          )
  95.  
  96.        ;; When running ispell, consider all 1-3 character words as correct.
  97.        (setq ispell-extra-args '("-W" "3"))
  98.  
  99.        (cond ((or (not (fboundp 'device-type))
  100.           (equal (device-type) 'x))
  101.           ;; Code which applies only when running emacs under X goes here.
  102.           ;; (We check whether the function `device-type' exists
  103.           ;; before using it.  In versions before 19.12, there
  104.           ;; was no such function.  If it doesn't exist, we
  105.           ;; simply assume we're running under X -- versions before
  106.           ;; 19.12 only supported X.)
  107.  
  108.           ;; Remove the binding of C-x C-c, which normally exits emacs.
  109.           ;; It's easy to hit this by mistake, and that can be annoying.
  110.           ;; Under X, you can always quit with the "Exit Emacs" option on
  111.           ;; the File menu.
  112.           (global-set-key "\C-x\C-c" nil)
  113.  
  114.           ;; Uncomment this to enable "sticky modifier keys" in 19.13
  115.           ;; and up.  With sticky modifier keys enabled, you can
  116.           ;; press and release a modifier key before pressing the
  117.           ;; key to be modified, like how the ESC key works always.
  118.           ;; If you hold the modifier key down, however, you still
  119.           ;; get the standard behavior.  I personally think this
  120.           ;; is the best thing since sliced bread (and a *major*
  121.           ;; win when it comes to reducing Emacs pinky), but it's
  122.           ;; disorienting at first so I'm not enabling it here by
  123.           ;; default.
  124.  
  125.           ;;(setq modifier-keys-are-sticky t)
  126.  
  127.           ;; This changes the variable which controls the text that goes
  128.           ;; in the top window title bar.  (However, it is not changed
  129.           ;; unless it currently has the default value, to avoid
  130.           ;; interfering with a -wn command line argument I may have
  131.           ;; started emacs with.)
  132.           (if (equal frame-title-format "%S: %b")
  133.           (setq frame-title-format
  134.             (concat "%S: " invocation-directory invocation-name
  135.                 " [" emacs-version "]"
  136.                 (if nil ; (getenv "NCD")
  137.                     ""
  138.                   "   %b"))))
  139.  
  140.           ;; If we're running on display 0, load some nifty sounds that
  141.           ;; will replace the default beep.  But if we're running on a
  142.           ;; display other than 0, which probably means my NCD X terminal,
  143.           ;; which can't play digitized sounds, do two things: reduce the
  144.           ;; beep volume a bit, and change the pitch of the sound that is
  145.           ;; made for "no completions."
  146.           ;;
  147.           ;; (Note that sampled sounds only work if XEmacs was compiled
  148.           ;; with sound support, and we're running on the console of a
  149.           ;; Sparc, HP, or SGI machine, or on a machine which has a
  150.           ;; NetAudio server; otherwise, you just get the standard beep.)
  151.           ;;
  152.           ;; (Note further that changing the pitch and duration of the
  153.           ;; standard beep only works with some X servers; many servers
  154.           ;; completely ignore those parameters.)
  155.           ;;
  156.           (cond ((string-match ":0" (getenv "DISPLAY"))
  157.              (load-default-sounds))
  158.             (t
  159.              (setq bell-volume 40)
  160.              (setq sound-alist
  161.                (append sound-alist '((no-completion :pitch 500))))
  162.              ))
  163.  
  164.           ;; Make `C-x C-m' and `C-x RET' be different (since I tend
  165.           ;; to type the latter by accident sometimes.)
  166.           (define-key global-map [(control x) return] nil)
  167.  
  168.           ;; Change the pointer used when the mouse is over a modeline
  169.           (set-glyph-image modeline-pointer-glyph "leftbutton")
  170.  
  171.           ;; Change the continuation glyph face so it stands out more
  172.           (and (fboundp 'set-glyph-property)
  173.            (boundp 'continuation-glyph)
  174.            (set-glyph-property continuation-glyph 'face 'bold))
  175.  
  176.           ;; Change the pointer used during garbage collection.
  177.           ;;
  178.           ;; Note that this pointer image is rather large as pointers go,
  179.           ;; and so it won't work on some X servers (such as the MIT
  180.           ;; R5 Sun server) because servers may have lamentably small
  181.           ;; upper limits on pointer size.
  182.           ;;(if (featurep 'xpm)
  183.           ;;   (set-glyph-image gc-pointer-glyph
  184.           ;;     (expand-file-name "trash.xpm" data-directory)))
  185.  
  186.           ;; Here's another way to do that: it first tries to load the
  187.           ;; pointer once and traps the error, just to see if it's
  188.           ;; possible to load that pointer on this system; if it is,
  189.           ;; then it sets gc-pointer-glyph, because we know that
  190.           ;; will work.  Otherwise, it doesn't change that variable
  191.           ;; because we know it will just cause some error messages.
  192.           (if (featurep 'xpm)
  193.           (let ((file (expand-file-name "recycle.xpm" data-directory)))
  194.             (if (condition-case error
  195.                 ;; check to make sure we can use the pointer.
  196.                 (make-image-instance file nil
  197.                          '(pointer))
  198.               (error nil))        ; returns nil if an error occurred.
  199.             (set-glyph-image gc-pointer-glyph file))))
  200.  
  201.           (when (featurep 'menubar)
  202.         ;; Add `dired' to the File menu
  203.         (add-menu-button '("File") ["Edit Directory" dired t])
  204.  
  205.         ;; Here's a way to add scrollbar-like buttons to the menubar
  206.         (add-menu-button nil ["Top" beginning-of-buffer t])
  207.         (add-menu-button nil ["<<<" scroll-down         t])
  208.         (add-menu-button nil [" . " recenter            t])
  209.         (add-menu-button nil [">>>" scroll-up           t])
  210.         (add-menu-button nil ["Bot" end-of-buffer       t]))
  211.  
  212.           ;; Change the behavior of mouse button 2 (which is normally
  213.           ;; bound to `mouse-yank'), so that it inserts the selected text
  214.           ;; at point (where the text cursor is), instead of at the
  215.           ;; position clicked.
  216.           ;;
  217.           ;; Note that you can find out what a particular key sequence or
  218.           ;; mouse button does by using the "Describe Key..." option on
  219.           ;; the Help menu.
  220.           (setq mouse-yank-at-point t)
  221.  
  222.           ;; When editing C code (and Lisp code and the like), I often
  223.           ;; like to insert tabs into comments and such.  It gets to be
  224.           ;; a pain to always have to use `C-q TAB', so I set up a more
  225.           ;; convenient binding.  Note that this does not work in
  226.           ;; TTY frames, where tab and shift-tab are indistinguishable.
  227.           (define-key global-map '(shift tab) 'self-insert-command)
  228.  
  229.           ;; LISPM bindings of Control-Shift-C and Control-Shift-E.
  230.           ;; Note that "\C-C" means Control-C, not Control-Shift-C.
  231.           ;; To specify shifted control characters, you must use the
  232.           ;; more verbose syntax used here.
  233.           (define-key emacs-lisp-mode-map '(control C) 'compile-defun)
  234.           (define-key emacs-lisp-mode-map '(control E) 'eval-defun)
  235.  
  236.           ;; If you like the FSF Emacs binding of button3 (single-click
  237.           ;; extends the selection, double-click kills the selection),
  238.           ;; uncomment the following:
  239.  
  240.           ;; Under 19.13, the following is enough:
  241.               ;(define-key global-map 'button3 'mouse-track-adjust)
  242.  
  243.           ;; But under 19.12, you need this:
  244.               ;(define-key global-map 'button3
  245.               ;    (lambda (event)
  246.               ;      (interactive "e")
  247.               ;      (let ((default-mouse-track-adjust t))
  248.               ;        (mouse-track event))))
  249.  
  250.           ;; Under both 19.12 and 19.13, you also need this:
  251.               ;(add-hook 'mouse-track-click-hook
  252.               ;          (lambda (event count)
  253.               ;            (if (or (/= (event-button event) 3)
  254.               ;                    (/= count 2))
  255.               ;                nil ;; do the normal operation
  256.               ;              (kill-region (point) (mark))
  257.               ;              t ;; don't do the normal operations.
  258.               ;              )))
  259.  
  260.           ))
  261.  
  262.        ))
  263.  
  264. ;; Oh, and here's a cute hack you might want to put in the sample .emacs
  265. ;; file: it changes the color of the window if it's not on the local
  266. ;; machine, or if it's running as root:
  267.  
  268. ;; local emacs background:  whitesmoke
  269. ;; remote emacs background: palegreen1
  270. ;; root emacs background:   coral2
  271. (cond
  272.  ((and (string-match "XEmacs" emacs-version)
  273.        (eq window-system 'x)
  274.        (boundp 'emacs-major-version)
  275.        (= emacs-major-version 19)
  276.        (>= emacs-minor-version 12))
  277.   (let* ((root-p (eq 0 (user-uid)))
  278.      (dpy (or (getenv "DISPLAY") ""))
  279.      (remote-p (not
  280.             (or (string-match "^\\(\\|unix\\|localhost\\):" dpy)
  281.             (let ((s (system-name)))
  282.               (if (string-match "\\.\\(netscape\\|mcom\\)\\.com" s)
  283.                   (setq s (substring s 0 (match-beginning 0))))
  284.               (string-match (concat "^" (regexp-quote s)) dpy)))))
  285.      (bg (cond (root-p "coral2")
  286.            (remote-p "palegreen1")
  287.            (t nil))))
  288.     (cond (bg
  289.        (let ((def (color-name (face-background 'default)))
  290.          (faces (face-list)))
  291.          (while faces
  292.            (let ((obg (face-background (car faces))))
  293.          (if (and obg (equal def (color-name obg)))
  294.              (set-face-background (car faces) bg)))
  295.            (setq faces (cdr faces)))))))))
  296.  
  297.  
  298. ;;; Older versions of emacs did not have these variables
  299. ;;; (emacs-major-version and emacs-minor-version.)
  300. ;;; Let's define them if they're not around, since they make
  301. ;;; it much easier to conditionalize on the emacs version.
  302.  
  303. (if (and (not (boundp 'emacs-major-version))
  304.      (string-match "^[0-9]+" emacs-version))
  305.     (setq emacs-major-version
  306.       (string-to-int (substring emacs-version
  307.                     (match-beginning 0) (match-end 0)))))
  308. (if (and (not (boundp 'emacs-minor-version))
  309.      (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version))
  310.     (setq emacs-minor-version
  311.       (string-to-int (substring emacs-version
  312.                     (match-beginning 1) (match-end 1)))))
  313.  
  314. ;;; Define a function to make it easier to check which version we're
  315. ;;; running.
  316.  
  317. (defun running-emacs-version-or-newer (major minor)
  318.   (or (> emacs-major-version major)
  319.       (and (= emacs-major-version major)
  320.        (>= emacs-minor-version minor))))
  321.  
  322. (cond ((and running-xemacs
  323.         (running-emacs-version-or-newer 19 6))
  324.        ;;
  325.        ;; Code requiring XEmacs/Lucid Emacs version 19.6 or newer goes here
  326.        ;;
  327.        ))
  328.  
  329. (cond ((>= emacs-major-version 19)
  330.        ;;
  331.        ;; Code for any vintage-19 emacs goes here
  332.        ;;
  333.        ))
  334.  
  335. (cond ((and (not running-xemacs)
  336.         (>= emacs-major-version 19))
  337.        ;;
  338.        ;; Code specific to FSF Emacs 19 (not XEmacs/Lucid Emacs) goes here
  339.        ;;
  340.        ))
  341.  
  342. (cond ((< emacs-major-version 19)
  343.        ;;
  344.        ;; Code specific to emacs 18 goes here
  345.        ;;
  346.        ))
  347.  
  348.  
  349. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  350. ;;        Customization of Specific Packages            ;;
  351. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  352.  
  353. ;;; Load gnuserv, which will allow you to connect to XEmacs sessions
  354. ;;; using `gnuclient'.
  355.  
  356. ;; If you never run more than one XEmacs at a time, you might want to
  357. ;; always start gnuserv.  Otherwise it is preferable to specify
  358. ;; `-f gnuserv-start' on the command line to one of the XEmacsen.
  359. ; (gnuserv-start)
  360.  
  361.  
  362. ;;; ********************
  363. ;;; Load efs, which uses the FTP protocol as a pseudo-filesystem.
  364. ;;; When this is loaded, the pathname syntax /user@host:/remote/path
  365. ;;; refers to files accessible through ftp.
  366. ;;;
  367. (require 'dired)
  368. ;; compatible ange-ftp/efs initialization derived from code
  369. ;; from John Turner <turner@lanl.gov>
  370. ;; As of 19.15, efs is bundled instead of ange-ftp.
  371. ;; NB: doesn't handle 20.0 properly, efs didn't appear until 20.1.
  372. ;;
  373. ;; The environment variable EMAIL_ADDRESS is used as the password
  374. ;; for access to anonymous ftp sites, if it is set.  If not, one is
  375. ;; constructed using the environment variables USER and DOMAINNAME
  376. ;; (e.g. turner@lanl.gov), if set.
  377.  
  378. (if (and running-xemacs
  379.      (or (and (= emacs-major-version 20) (>= emacs-minor-version 1))
  380.          (and (= emacs-major-version 19) (>= emacs-minor-version 15))))
  381.     (progn
  382.       (message "Loading and configuring bundled packages... efs")
  383.       (require 'efs-auto)
  384.       (if (getenv "USER")
  385.       (setq efs-default-user (getenv "USER")))
  386.       (if (getenv "EMAIL_ADDRESS")
  387.       (setq efs-generate-anonymous-password (getenv "EMAIL_ADDRESS"))
  388.     (if (and (getenv "USER")
  389.          (getenv "DOMAINNAME"))
  390.         (setq efs-generate-anonymous-password
  391.           (concat (getenv "USER")"@"(getenv "DOMAINNAME")))))
  392.       (setq efs-auto-save 1))
  393.   (progn
  394.     (message "Loading and configuring bundled packages... ange-ftp")
  395.     (require 'ange-ftp)
  396.     (if (getenv "USER")
  397.     (setq ange-ftp-default-user (getenv "USER")))
  398.     (if (getenv "EMAIL_ADDRESS")
  399.     (setq ange-ftp-generate-anonymous-password (getenv "EMAIL_ADDRESS"))
  400.       (if (and (getenv "USER")
  401.            (getenv "DOMAINNAME"))
  402.       (setq ange-ftp-generate-anonymous-password
  403.         (concat (getenv "USER")"@"(getenv "DOMAINNAME")))))
  404.     (setq ange-ftp-auto-save 1)
  405.     )
  406.   )
  407.  
  408. ;;; ********************
  409. ;;; Load the default-dir.el package which installs fancy handling
  410. ;;;  of the initial contents in the minibuffer when reading
  411. ;;; file names.
  412.  
  413. (if (and running-xemacs
  414.      (or (and (= emacs-major-version 20) (>= emacs-minor-version 1))
  415.          (and (= emacs-major-version 19) (>= emacs-minor-version 15))))
  416.     (require 'default-dir))
  417.  
  418. ;;; ********************
  419. ;;; Load the auto-save.el package, which lets you put all of your autosave
  420. ;;; files in one place, instead of scattering them around the file system.
  421. ;;;
  422. (setq auto-save-directory (expand-file-name "~/autosave/")
  423.       auto-save-directory-fallback auto-save-directory
  424.       auto-save-hash-p nil
  425.       efs-auto-save t
  426.       efs-auto-save-remotely nil
  427.       ;; now that we have auto-save-timeout, let's crank this up
  428.       ;; for better interactive response.
  429.       auto-save-interval 2000
  430.       )
  431. ;; We load this afterwards because it checks to make sure the
  432. ;; auto-save-directory exists (creating it if not) when it's loaded.
  433. (require 'auto-save)
  434.  
  435. ;; This adds additional extensions which indicate files normally
  436. ;; handled by cc-mode.
  437. (setq auto-mode-alist
  438.       (append '(("\\.C$"  . c++-mode)
  439.         ("\\.cc$" . c++-mode)
  440.         ("\\.hh$" . c++-mode)
  441.         ("\\.c$"  . c-mode)
  442.         ("\\.h$"  . c-mode))
  443.           auto-mode-alist))
  444.  
  445.  
  446. ;;; ********************
  447. ;;; cc-mode (the mode you're in when editing C, C++, and Objective C files)
  448.  
  449. ;; Tell cc-mode not to check for old-style (K&R) function declarations.
  450. ;; This speeds up indenting a lot.
  451. (setq c-recognize-knr-p nil)
  452.  
  453. ;; Change the indentation amount to 4 spaces instead of 2.
  454. ;; You have to do it in this complicated way because of the
  455. ;; strange way the cc-mode initializes the value of `c-basic-offset'.
  456. (add-hook 'c-mode-hook (lambda () (setq c-basic-offset 4)))
  457.  
  458.  
  459. ;;; ********************
  460. ;;; Load a partial-completion mechanism, which makes minibuffer completion
  461. ;;; search multiple words instead of just prefixes; for example, the command
  462. ;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
  463. ;;; because there are no other commands whose first three words begin with
  464. ;;; the letters `b', `c', and `a' respectively.
  465. ;;;
  466. (load-library "completer")
  467.  
  468.  
  469. ;;; ********************
  470. ;;; Load crypt, which is a package for automatically decoding and reencoding
  471. ;;; files by various methods - for example, you can visit a .Z or .gz file,
  472. ;;; edit it, and have it automatically re-compressed when you save it again.
  473. ;;; 
  474. (setq crypt-encryption-type 'pgp   ; default encryption mechanism
  475.       crypt-confirm-password t       ; make sure new passwords are correct
  476.       ;crypt-never-ever-decrypt t  ; if you don't encrypt anything, set this to
  477.                    ; tell it not to assume that "binary" files
  478.                    ; are encrypted and require a password.
  479.       )
  480. (require 'crypt)
  481.  
  482.  
  483. ;;; ********************
  484. ;;; Edebug is a source-level debugger for emacs-lisp programs.
  485. ;;;
  486. (define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun)
  487.  
  488.  
  489. ;;; ********************
  490. ;;; Font-Lock is a syntax-highlighting package.  When it is enabled and you
  491. ;;; are editing a program, different parts of your program will appear in
  492. ;;; different fonts or colors.  For example, with the code below, comments
  493. ;;; appear in red italics, function names in function definitions appear in
  494. ;;; blue bold, etc.  The code below will cause font-lock to automatically be
  495. ;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of
  496. ;;; programs.
  497. ;;;
  498. ;;; The "Options" menu has some commands for controlling this as well.
  499. ;;;
  500. (cond (running-xemacs
  501.  
  502.        ;; If you want the default colors, you could do this:
  503.        ;; (setq font-lock-use-default-fonts nil)
  504.        ;; (setq font-lock-use-default-colors t)
  505.        ;; but I want to specify my own colors, so I turn off all
  506.        ;; default values.
  507.        (setq font-lock-use-default-fonts nil)
  508.        (setq font-lock-use-default-colors nil)
  509.  
  510.        (require 'font-lock)
  511.  
  512.        ;; Mess around with the faces a bit.  Note that you have
  513.        ;; to change the font-lock-use-default-* variables *before*
  514.        ;; loading font-lock, and wait till *after* loading font-lock
  515.        ;; to customize the faces.
  516.  
  517.        ;; string face is green
  518.        (set-face-foreground 'font-lock-string-face "forest green")
  519.  
  520.        ;; comments are italic and red; doc strings are italic
  521.        ;;
  522.        ;; (I use copy-face instead of make-face-italic/make-face-bold
  523.        ;; because the startup code does intelligent things to the
  524.        ;; 'italic and 'bold faces to ensure that they are different
  525.        ;; from the default face.  For example, if the default face
  526.        ;; is bold, then the 'bold face will be unbold.)
  527.        (copy-face 'italic 'font-lock-comment-face)
  528.        ;; Underlining comments looks terrible on tty's
  529.        (set-face-underline-p 'font-lock-comment-face nil 'global 'tty)
  530.        (set-face-highlight-p 'font-lock-comment-face t 'global 'tty)
  531.        (copy-face 'font-lock-comment-face 'font-lock-doc-string-face)
  532.        (set-face-foreground 'font-lock-comment-face "red")
  533.  
  534.        ;; function names are bold and blue
  535.        (copy-face 'bold 'font-lock-function-name-face)
  536.        (set-face-foreground 'font-lock-function-name-face "blue")
  537.  
  538.        ;; misc. faces
  539.        (and (find-face 'font-lock-preprocessor-face) ; 19.13 and above
  540.             (copy-face 'bold 'font-lock-preprocessor-face))
  541.        (copy-face 'italic 'font-lock-type-face)
  542.        (copy-face 'bold 'font-lock-keyword-face)
  543.        ))
  544.  
  545.  
  546. ;;; ********************
  547. ;;; fast-lock is a package which speeds up the highlighting of files
  548. ;;; by saving information about a font-locked buffer to a file and
  549. ;;; loading that information when the file is loaded again.  This
  550. ;;; requires a little extra disk space be used.
  551. ;;;
  552. ;;; Normally fast-lock puts the cache file (the filename appended with
  553. ;;; .flc) in the same directory as the file it caches.  You can
  554. ;;; specify an alternate directory to use by setting the variable
  555. ;;; fast-lock-cache-directories.
  556.  
  557. ;; Let's use lazy-lock instead.
  558. ;;(add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
  559. ;;(setq fast-lock-cache-directories '("/foo/bar/baz"))
  560.  
  561.  
  562. ;;; ********************
  563. ;;; lazy-lock is a package which speeds up the highlighting of files
  564. ;;; by doing it "on-the-fly" -- only the visible portion of the
  565. ;;; buffer is fontified.  The results may not always be quite as
  566. ;;; accurate as using full font-lock or fast-lock, but it's *much*
  567. ;;; faster.  No more annoying pauses when you load files.
  568.  
  569. (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
  570. ;; I personally don't like "stealth mode" (where lazy-lock starts
  571. ;; fontifying in the background if you're idle for 30 seconds)
  572. ;; because it takes too long to wake up again on my piddly Sparc 1+.
  573. (setq lazy-lock-stealth-time nil)
  574.  
  575.  
  576. ;;; ********************
  577. ;;; func-menu is a package that scans your source file for function
  578. ;;; definitions and makes a menubar entry that lets you jump to any
  579. ;;; particular function definition by selecting it from the menu.  The
  580. ;;; following code turns this on for all of the recognized languages.
  581. ;;; Scanning the buffer takes some time, but not much.
  582. ;;;
  583. ;;; Send bug reports, enhancements etc to:
  584. ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl>
  585. ;;;
  586. (cond (running-xemacs
  587.        (require 'func-menu)
  588.        (define-key global-map 'f8 'function-menu)
  589.        (add-hook 'find-file-hooks 'fume-add-menubar-entry)
  590.        (define-key global-map "\C-cl" 'fume-list-functions)
  591.        (define-key global-map "\C-cg" 'fume-prompt-function-goto)
  592.  
  593.        ;; The Hyperbole information manager package uses (shift button2) and
  594.        ;; (shift button3) to provide context-sensitive mouse keys.  If you
  595.        ;; use this next binding, it will conflict with Hyperbole's setup.
  596.        ;; Choose another mouse key if you use Hyperbole.
  597.        (define-key global-map '(shift button3) 'mouse-function-menu)
  598.  
  599.        ;; For descriptions of the following user-customizable variables,
  600.        ;; type C-h v <variable>
  601.        (setq fume-max-items 25
  602.              fume-fn-window-position 3
  603.              fume-auto-position-popup t
  604.              fume-display-in-modeline-p t
  605.              fume-menubar-menu-location "File"
  606.              fume-buffer-name "*Function List*"
  607.              fume-no-prompt-on-valid-default nil)
  608.        ))
  609.  
  610.  
  611. ;;; ********************
  612. ;;; MH is a mail-reading system from the Rand Corporation that relies on a
  613. ;;; number of external filter programs (which do not come with emacs.)
  614. ;;; Emacs provides a nice front-end onto MH, called "mh-e".
  615. ;;;
  616. ;; Bindings that let you send or read mail using MH
  617. ;(global-set-key "\C-xm"  'mh-smail)
  618. ;(global-set-key "\C-x4m" 'mh-smail-other-window)
  619. ;(global-set-key "\C-cr"  'mh-rmail)
  620.  
  621. ;; Customization of MH behavior.
  622. (setq mh-delete-yanked-msg-window t)
  623. (setq mh-yank-from-start-of-msg 'body)
  624. (setq mh-summary-height 11)
  625.  
  626. ;; Use lines like the following if your version of MH
  627. ;; is in a special place.
  628. ;(setq mh-progs "/usr/dist/pkgs/mh/bin.svr4/")
  629. ;(setq mh-lib "/usr/dist/pkgs/mh/lib.svr4/")
  630.  
  631.  
  632. ;;; ********************
  633. ;;; resize-minibuffer-mode makes the minibuffer automatically
  634. ;;; resize as necessary when it's too big to hold its contents.
  635.  
  636. (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
  637. (resize-minibuffer-mode)
  638. (setq resize-minibuffer-window-exactly nil)
  639.  
  640. ;;; ********************
  641. ;;; W3 is a browser for the World Wide Web, and takes advantage of the very
  642. ;;; latest redisplay features in XEmacs.  You can access it simply by typing 
  643. ;;; 'M-x w3'; however, if you're unlucky enough to be on a machine that is 
  644. ;;; behind a firewall, you will have to do something like this first:
  645.  
  646. ;(setq w3-use-telnet t
  647. ;      ;;
  648. ;      ;; If the Telnet program you use to access the outside world is
  649. ;      ;; not called "telnet", specify its name like this.
  650. ;      w3-telnet-prog "itelnet"
  651. ;      ;;
  652. ;      ;; If your Telnet program adds lines of junk at the beginning
  653. ;      ;; of the session, specify the number of lines here.
  654. ;      w3-telnet-header-length 4
  655. ;      )
  656.